<?php 
class ConsultaPorMail
{	
	
	public $frmEmail;
	public $frmTelefono;
	public $frmConsulta;
		
    //-------------------------------------------
	
	function __construct() {
		
		$this->frmTelefono="";
	}
	
    //-------------------------------------------
	
	function control() {
	
		$this->getData();
		$this->sendMail();
		
		$amc=new AppMainController();
		$amc->addMessage("Se envio su consulta con exito. Rapidamente sera respondida");
		//$amc->getMessages();
	}
	
    //-------------------------------------------

	function getData() {
	
		if (isset($_POST["frmEmail"])){$this->frmEmail=$_POST["frmEmail"];};
		if (isset($_POST["frmTelefono"])){$this->frmTelefono=$_POST["frmTelefono"];};
		if (isset($_POST["frmConsulta"])){$this->frmConsulta=$_POST["frmConsulta"];};
		
	}
	
    //-------------------------------------------
	
	function sendMail() {
	
		$emailFrom=$this->frmEmail;
		$emailTo="cv.alquilerestemporarios@hotmail.com";
		$emailSubject="Consulta Alquiler";		
		$emailBody="Consulta: " . $this->frmConsulta . " Tel:" . $this->frmTelefono;
	
		$cabeceras = "From: " . $emailFrom . "\r\n" .
		"Reply-To: " . $emailFrom . "\r\n" .
		"Bcc: martinporto@gmail.com" . "\r\n" . 
		"X-Mailer: PHP/" . phpversion();	
		
		$GLOBALS["firephp"]->info($emailTo);
		$GLOBALS["firephp"]->info($emailSubject);
		$GLOBALS["firephp"]->info($emailBody);
		$GLOBALS["firephp"]->info($cabeceras);
		
		mail(
			$emailTo, 
			$emailSubject, 
			$emailBody,
			$cabeceras
			);
		
	}
}
?>